package com.yaodian100.ec.timelimitsale.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.yaodian100.core.common.entity.BaseEntity;
import com.yaodian100.ec.product.entity.Product;

/**
 * @author apple.chang
 * 
 */

@Entity
@Table(name = "EC_TIME_LIMIT_PROD")
public class TimeLimitProd extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4030424705425914385L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_ec_time_limit_prod")
	@SequenceGenerator(name = "seq_ec_time_limit_prod", sequenceName = "SEQ_EC_TIME_LIMIT_PROD")
	@Column(name = "ID")
	private Long id;

	/**
	 * 主檔編號
	 */
	@Column(name = "MAIN_ID", nullable = false)
	private Long mainId;

	/**
	 * 起始時間
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "START_DATE", nullable = false)
	private Date startDate;

	/**
	 * 結束時間
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "END_DATE", nullable = false)
	private Date endDate;

	/**
	 * 商品編號
	 */
	@Column(name = "PRODUCT_ID", length = 8)
	private String productId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PRODUCT_ID", insertable = false, updatable = false)
	private Product product;

	/**
	 * 是否重複上一檔次
	 */
	@Column(name = "IS_REPEAT", length = 1)
	private String isRepeat;

	/**
	 * 會員價
	 */
	@Column(name = "MEMBER_PRICE", nullable = false, columnDefinition = "NUMERIC(10, 2)")
	private BigDecimal memberPrice;

	/**
	 * 搶購價
	 */
	@Column(name = "LIMIT_PRICE", nullable = false, columnDefinition = "NUMERIC(10, 2)")
	private BigDecimal limitPrice;

	/**
	 * 商品名稱
	 */
	@Column(name = "PRODUCT_NAME", nullable = false, length = 40)
	private String productName;

	/**
	 * 首頁商品名稱
	 */
	@Column(name = "IDX_PRODUCT_NAME", length = 30)
	private String idxProductName;

	/**
	 * 圖檔路徑
	 */
	@Column(name = "IMAGE_PATH", nullable = false, length = 200)
	private String imagePath;

	/**
	 * 是否限制購買數量
	 */
	@Column(name = "IS_LIMIT_BUY", length = 1)
	private String isLimitBuy;

	/**
	 * 廣告代碼
	 */
	@Column(name = "AD_WORD", length = 25)
	private String adWord;

	/**
	 * 圆标
	 */
	@Column(name = "ROUND_TAG", length = 8)
	private String roundTag;

	/**
	 * 上架档编号
	 */
	@Column(name = "SHELF_ID")
	private Long shelfId;
	
	/**
	 * 团购活动上架档编号
	 */
	@Column(name = "TUANGOU_ID")
	private Long tuangouId;

	/**
	 * 
	 */
	@Transient
	private Date tmpEndDate;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	public String getIsRepeat() {
		return isRepeat;
	}

	public void setIsRepeat(String isRepeat) {
		this.isRepeat = isRepeat;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public BigDecimal getMemberPrice() {
		return memberPrice;
	}

	public void setMemberPrice(BigDecimal memberPrice) {
		this.memberPrice = memberPrice;
	}

	public BigDecimal getLimitPrice() {
		return limitPrice;
	}

	public void setLimitPrice(BigDecimal limitPrice) {
		this.limitPrice = limitPrice;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getIdxProductName() {
		return idxProductName;
	}

	public void setIdxProductName(String idxProductName) {
		this.idxProductName = idxProductName;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public String getIsLimitBuy() {
		return isLimitBuy;
	}

	public void setIsLimitBuy(String isLimitBuy) {
		this.isLimitBuy = isLimitBuy;
	}

	public Long getMainId() {
		return mainId;
	}

	public void setMainId(Long mainId) {
		this.mainId = mainId;
	}

	public Date getTmpEndDate() {
		return tmpEndDate;
	}

	public void setTmpEndDate(Date tmpEndDate) {
		this.tmpEndDate = tmpEndDate;
	}

	public String getAdWord() {
		return adWord;
	}

	public void setAdWord(String adWord) {
		this.adWord = adWord;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public String getRoundTag() {
		return roundTag;
	}

	public void setRoundTag(String roundTag) {
		this.roundTag = roundTag;
	}

	public Long getShelfId() {
		return shelfId;
	}

	public void setShelfId(Long shelfId) {
		this.shelfId = shelfId;
	}

	public Long getTuangouId() {
		return tuangouId;
	}

	public void setTuangouId(Long tuangouId) {
		this.tuangouId = tuangouId;
	}
}